<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/view/common/taglibs.jsp"%>
<script type="text/javascript">
var setting = {
		view: {
			selectedMulti: false,
			showIcon:true
		},
		check: {
			enable: true,
			chkStyle: "radio",
			nocheckInherit: false, //当父节点设置 nocheck = true 时，设置子节点是否自动继承 nocheck = true 
			radioType: "all"
		},
		data: {
			simpleData: {
				enable: true
			}
		},
		callback: {
			onCheck: getActionId
		}
	};
var zNodesForSelectAction = ${resourceData};
var ztreeForSelectAction;
$(document).ready(function(){
	$.fn.zTree.init($("#ztreeForSelectAction"), setting, zNodesForSelectAction);
	ztreeForSelectAction = $.fn.zTree.getZTreeObj("ztreeForSelectAction");
});
$(function() {
	$.radioInit('openNewWindow','${res.openNewWindow}');
	$.radioInit('open','${res.open}');
	$('#inputForm input').tooltip();
	$("#inputForm").checkForm();
	$("#inputForm").jsonAjaxForm({
		pageRefresh:true
	});	
});
function getActionId(event, treeId, treeNode, clickFlag){
	$("#actionId").val("");
	var checkedNodes = ztreeForSelectAction.getCheckedNodes(true);
	for(var i in checkedNodes){
		$("#actionId").val(checkedNodes[i].id);
		break;
	}
}
</script>
<div class="widget-header widget-header-flat">
	<h5 class="smaller lighter">
		&nbsp;
	</h5>
	<div class="widget-toolbar no-border">
	</div>
</div>
<div class="widget-body">
	<div class="widget-main">
		<form class="form-horizontal" role="form" id="inputForm" action="${ctx}/pub/sysmgr/resmgr/set_action.do" method="post">
			<input type="hidden" name="id" id="id" value="${res.id}" />
			<input type="hidden" name="actionId" id="actionId" value="${res.actionId}" />
			<div class="space-4"></div>
			<div class="form-group">
				<div class="col-sm-3 control-label no-padding-right" for="form-field-1">资源简称 </div>
				<div class="col-sm-9">
					<input type="text" class="col-xs-10 col-sm-5" 
						value="${res.shortName}"  name="shortName" id="shortName" title="资源编码，不可修改" readonly/>
				</div>
			</div>
			<div class="space-4"></div>
			<div class="form-group">
				<div class="col-sm-3 control-label no-padding-right" for="form-field-1">是否在新窗口打开 </div>
				<div class="col-sm-9" style="padding-top: 7px;">
					否 <input type="radio" name="openNewWindow" value="0" />
					是 <input type="radio" name="openNewWindow" value="1"/>
				</div>
			</div>
			<div class="space-4"></div>
			<div class="form-group">
				<div class="col-sm-3 control-label no-padding-right" for="form-field-1">是否默认打开 </div>
				<div class="col-sm-9" style="padding-top: 7px;">
					否 <input type="radio" name="open" value="0" />
					是 <input type="radio" name="open" value="1"/>
				</div>
			</div>
			<div class="space-4"></div>
			<div class="form-group">
				<div class="col-sm-3 control-label no-padding-right" for="form-field-1">选择点击菜单打开的地址 </div>
				<div class="col-sm-9">
					<ul id="ztreeForSelectAction" class="ztree"></ul>
				</div>
			</div>
			<hr>
			<div class="clearfix form-group">
				<div class="col-md-offset-3 col-md-9">
					<button type="submit" class="btn btn-sm btn-info" id="sbmBtn"><i class="icon-ok bigger-110"></i>提交</button>
				</div>
			</div>
		</form>
	</div>
</div>
